package com.itheima.d3_abstract;

public class Demo02 {
    public static void main(String[] args) {
        // 目标：掌握抽象类的使用场景和好处.
        Animal a = new Cat();
        a.cry();

        System.out.println("=======");
        show(new Cat());
        show(new Dog());

    }

    public static void show(Animal animal) {
        if (animal instanceof Dog) {
            Dog dog = (Dog) animal;
            dog.cry();
        }
        if(animal instanceof  Cat){
            Cat cat = (Cat) animal;
            cat.cry();
        }
    }
}
